package com.xiaoye.service;

import com.xiaoye.dao.AdminMapper;
import com.xiaoye.entity.Admin;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.jnlp.IntegrationService;
import java.util.List;

/**
 * @author 宵夜
 * @version 1.0.0
 * @Description: TODO
 */
@Service
public class AdminService {

    @Autowired
    private AdminMapper adminMapper;

    //添加
    public boolean insert(Admin admin){
        return adminMapper.insert(admin) == 1;
    }

    //删除
    public boolean deleteById(Integer id){
        return adminMapper.deleteById(id) == 1;
    }

    //根据no查找单个admin
    public Admin getByNo(String no){
        return adminMapper.getByNo(no);
    }

    //根据id查找单个admin
    public Admin getById(Integer id){
        return adminMapper.getById(id);
    }

    //通过实体查找符合实体的list
    public List<Admin> listAdmins(Admin admin){
      return   adminMapper.listAdmins(admin);
    }

    //修改admin
    public boolean update(Admin admin){
        return adminMapper.update(admin) == 1;
    }


}
